package com.gzbit.calculator.ui;

public class BoxTest {
    public static void main(String[] args) {
        Box<Integer> a = new Box<>();
        a.setA(5);
        System.out.println(a.getA());

        Box<Float> b = new Box<>(5.1f);
        System.out.println(b.getA());
    }
}

/*泛型类*/
class Box<T> {
    private T a;

    public T getA() {
        return a;
    }

    public void setA(T a) {
        this.a = a;
    }

    public Box() {
    }

    public Box(T a) {
        this.a = a;
    }
}